package net.worldscale.xp.wslib.urm;

final class ImplMimeType extends MimeType {

	public static MimeType newInstance(String mime) {
		return new ImplMimeType(mime);
	}

	private final String mPurePart;
	private final String mExtendPart;

	private ImplMimeType(final String mimeString) {
		if (mimeString == null) {
			this.mPurePart = "";
			this.mExtendPart = null;
			return;
		}
		final int i = mimeString.indexOf(';');
		if (i < 0) {
			this.mPurePart = mimeString;
			this.mExtendPart = null;
		} else {
			this.mPurePart = mimeString.substring(0, i);
			this.mExtendPart = mimeString.substring(i + 1);
		}
	}

	@Override
	public String getPurePart() {
		final String str = this.mPurePart;
		return ((str == null) ? "" : str);
	}

	public String toString() {
		String pp, ep;
		pp = this.mPurePart;
		ep = this.mExtendPart;
		if (pp == null) {
			pp = "";
		}
		if (ep == null) {
			return pp;
		} else {
			return (pp + ";" + ep);
		}
	}

	@Override
	public String getExtendPart() {
		final String str = this.mExtendPart;
		return ((str == null) ? "" : str);
	}

}
